package com.tg.paw.oms.scheduling;

import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.tg.paw.oms.mq.producer.OrderSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author Rubble
 * @date 2020/6/18
 */
@Component
public class DemoScheduling {

    @Autowired
    OrderSender orderSender;

//    @Scheduled(cron = "0/3 * * * * ?")
    public void demoSchedule(){

        JSONObject data = new JSONObject();
        data.put("date",DateUtil.now());

        orderSender.send(data.toJSONString());
    }
}
